/* WELTWEITIMNETZ BROWSER - Network Reply Classes
 *
 * Copyright (C) Philipp Ruppel, weltweitimnetz.de
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

#ifndef NETWORKREPLIES_H
#define NETWORKREPLIES_H

#include <QNetworkReply>
#include <QString>
#include <QNetworkRequest>
#include <QIODevice>
#include <QByteArray>
#include <QObject>
#include <QBuffer>
#include <qbuffer.h>


class ErrorNetworkReply : public QNetworkReply
{
Q_OBJECT

public:
    ErrorNetworkReply(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QObject* parent);
    virtual void abort();
protected slots:
    void errorNetworkReplyReady();
protected:
    qint64 readData ( char * data, qint64 maxSize );
};



class ArrayNetworkReply : public QNetworkReply
{
Q_OBJECT

private:
    //QByteArray content;
    //int offset;
    QBuffer buffer;
public:
    ArrayNetworkReply(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QByteArray data, QObject* parent);
    ~ArrayNetworkReply();
    //bool isSequential();
    virtual qint64 bytesAvailable();
    virtual void abort();
    virtual void close();
protected:
    qint64 readData ( char * data, qint64 maxSize );
protected slots:
    void arrayNetworkReplyReady();
};

#endif // NETWORKREPLIES_H
